<%
''读取json语言类配置文件
class cls_config

Public key(),value()
private count,

''仅读入文件
Public function load(byval fname)
	dim pth : pth = lcase(cstr( server.mappth(fname) ))
	dim text : text = eu_getCache(pth)
	if eu_isnull(text) then
		text = eu_readfile(fname)
		setCache(pth, text)
	end if
	load = text
end function

''加载文件并读入到数组中 用于显示修改
Public function load2array(byval fname)
	dim text:text = load(fname)
	dim obj:set obj = eu_json_obj(text)
	dim keys:keys = eu_json_keys(obj)
	dim ka : ka = split(keys,",")
	count = ubound(k) - lbound(k)
	redim key(count)
	redim value(count)
	dim idx
	for idx=0 to count
		key(idx) = trim(ka(idx))
		value(idx) = eu_json_val(key(idx), obj)
	next
	set obj=nothing
end function

''通过key找到value  {lang: model.article.title /}
Public function getByKey(byval opt)
	dim sp:sp = split(opt,".")
	getByKey = eu_getcache("language__"&opt)
	if eu_isnull(getByKey) then
		dim ikey:ikey = lcase(trim(sp(ubound(sp))))
		dim fname:fname = eu_confg_file(opt,"")
		dim text:text = load(fname)
		dim obj:set obj = eu_json_obj(text)
		getByKey = eu_json_val(ikey, obj)
		if not eu_isnull(getByKey) then setcache("language__"&opt, getByKey)
		set obj=nothing
	end if
end function

end class
%>